import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { ValidationPipe } from './Validator-Pipe';
import { HttpFilter } from './httpFilter'
declare const module: any;


async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.enableCors({
    origin: '*',
    methods: 'GET,PUT,POST',
    credentials: true,
    maxAge: 3600,
  });
  app.useGlobalPipes(new ValidationPipe());  //加在这里
  app.useGlobalFilters(new HttpFilter());
  await app.listen(3000);
  //webpack热重载
  if (module.hot) {
    module.hot.accept();
    module.hot.dispose(() => app.close());
  }
}
bootstrap();
